-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#6236] fix(core): fix possible resource leak in BaseCatalog #6253
base: main
Are you sure you want to change the base?
Conversation
@justinmclean @tengqm ,could you please review this PR when you have time? I’d really appreciate your feedback. |
fix possible resource leak in BaseCatalog.
…ate the plugin (apache#6246) Authorization should use classloader to create the plugin Fix: apache#6245 No. I tested it manually.
fix possible resource leak in BaseCatalog.
BaseAuthorization<?> authorization = | ||
BaseAuthorization.createAuthorization(classLoader, authorizationProvider); | ||
|
||
try (BaseAuthorization<?> authorization = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the authorization be closed after creating plugin? Do we need close method? cc @xunliu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is ok.
Another question is:
Should the authorization be closed after creating plugin? Do we need close method? cc @xunliu
We already closed the authorization plugin in the core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java#L229
@Override
public void close() throws IOException {
if (ops != null) {
ops.close();
ops = null;
}
if (authorizationPlugin != null) {
authorizationPlugin.close();
authorizationPlugin = null;
}
if (catalogCredentialManager != null) {
catalogCredentialManager.close();
catalogCredentialManager = null;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, Authorization
class is similar to a factory class. It's weird that the factory class has close
method.
What changes were proposed in this pull request?
Use
try-with-resource
to fix possible resource leak in BaseCatalog.Why are the changes needed?
Fix: #6236
Does this PR introduce any user-facing change?
No.
How was this patch tested?
local test.